package cn.webrx;

public class Excep1 {
    public static void main(String[] args) {
        //java.lang.ArithmeticException
        int i = 0;
        try{
            i = 3 / 0;
        }catch(Exception e){
            //e.printStackTrace();
            System.out.println("分母不能为0");
        }
        System.out.println("hello" + i);

        //java.lang.ArrayIndexOutOfBoundsException
        int[] arr = new int[6];
        System.out.println(arr[arr.length-1]);

        double[] dd = {1,2,3};
        System.out.println(dd[dd.length-1]);//3.0

        //java.lang.NullPointerException
        //try{
            Object obj = null;
            System.out.println(obj.toString());
        //}catch(Exception e){
        //    System.out.println("obj是空对象");
        //    e.printStackTrace();
        //}
        System.out.println("1234");
    }
}
